added samples
[windows-sources.git] / sdk / samples / all in on code / Visual Studio 2008 / CSWinFormLocalization / ReadMe.txt
blob2475ebd69740d0633b82c2a6b331900e76246b74
1 ================================================================================
2        WINDOWS FORMS APPLICATION : CSWinFormLocalization Project Overview
3                         
4 ===============================================================================
6 /////////////////////////////////////////////////////////////////////////////
7 Use:
9 The Windows Forms Localization sample demonstrates how to localize 
10 Windows Forms application.
11    
13 /////////////////////////////////////////////////////////////////////////////
14 Creation:
16 1. Create a new Windows Application named "CSWinFormLocalization". 
18 2. In the Properties window, set the form's Localizable property to true.
20 3. Drag two Button controls and one Label control from the Windows Forms tab 
21    of the Toolbox to the form, and set their Text property as follows:
22    
23    button1: "Hello World!",
24    button2: "I'm a button.",
25    label1 : "I'm a label".
26    
27 4. Set the form's Language property to Chinese (Simplified Chinese).
29 5. Set the Text property for the three controls as follows:
31    button1: "你好,世界!", 
32    button2: "我是一个按钮。", 
33    label1 : "我是一个标签。".
35 6. Save and build the solution.
37 7. Click the Show All Files button in Solution Explorer. 
39    The resource files appear underneath Form1.cs. 
40    Form1.resx is the resource file for the default culture.
41    Form1.zh-CHS.resx is the resource file for Simplified Chinese as spoken in PRC. 
43 8. Press Ctrl+F5 to run the application, the buttons and label will display in 
44    English or Simplified Chinese depending on the UI language of your o
45    perating system. 
46    
47 9. If you want the form always display in Simplified Chinese, you can set the 
48    UI culture to Simplified Chinese before calling the InitializeComponent method.
50     public Form1()
51     {
52         // Sets the UI culture to Simplified Chinese. 
53         Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh-CHS");
55         InitializeComponent();
56     }
57     
58     
60 /////////////////////////////////////////////////////////////////////////////
61 References:
63 1. Walkthrough: Localizing Windows Forms
64    http://msdn.microsoft.com/en-us/library/y99d1cd3.aspx
65    
66 2. Windows Forms General FAQ.
67    http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/77a66f05-804e-4d58-8214-0c32d8f43191
68    
70 /////////////////////////////////////////////////////////////////////////////